﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NewLife.Web;
using NewLife.Reflection;
using NewsPub;

public partial class Disp : Page
{
    /// <summary>编号</summary>
    public Int32 EntityID { get { return WebHelper.RequestInt("id"); } }

    private Details _Entity;
    /// <summary>客户</summary>
    public Details Entity
    {
        get { return _Entity ?? (_Entity = Details.FindByKeyForEdit(EntityID)); }
        set { _Entity = value; }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Entity.ID == 0) Response.Redirect("Default.aspx");
            DataBind();
            Entity.Hits++;
            Entity.Update();
            //Classis classis= Classis.FindByID(Entity.ClassisID);
            string location;
            if (Entity.Classis.ParentID == 0)
            {
                location = "<a href='Default.aspx'>首页</a>&nbsp;&gt;&nbsp;<a href='list.aspx?id=" + Entity.Classis.ID + "'>" + Entity.Classis.Name + "</a>";
            }
            else
            {
                location = "<a href='Default.aspx'>首页</a>&nbsp;&gt;&nbsp;<a href='list.aspx?id=" + Entity.Classis.ParentID + "'>" + Entity.Classis.ParentClassisName + "</a>&nbsp;&gt;&nbsp;<a href='list.aspx?id=" + Entity.Classis.ParentID + "&sid=" + Entity.Classis.ID + "'>" + Entity.Classis.Name + "</a>";
            }
            Navigation.Text = location;
            //navigation.Text = Navigation;
            //FieldInfoX fix = FieldInfoX.Create(Page.GetType(), "Manager");
            //if (fix != null)
            //{
            //    IManagePage manager = fix.GetValue(Page) as IManagePage;
            //    if (manager != null) Navigation.Text = manager.Navigation;
            //}
            //frmTitle.Text = Entity.Title;
            //frmCreatetime.Text = Entity.CreateTime.ToShortDateString();
            //frmBody.Text = Entity.Body;
        }
    }
}